package com.zhangfei.controller;

import com.zhangfei.config.SerialTagEnum;
import com.zhangfei.service.IdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RedisIDController {


    @Autowired
    private IdService idService;


    @GetMapping("/getServoidalNo")
    @ResponseBody
    public Boolean getSerialNo(String code) {
        SerialTagEnum tagEnum = SerialTagEnum.getEnumByValue(code);
        System.out.println("tagEnum:" + tagEnum);
        String serialNo = idService.getSerialNo(tagEnum);
        System.out.println("分布式ID:"+serialNo);
        return true;
    }

}
